<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        
        <title>
            
    
                Microsoft SQL Server
             &mdash; 
    SQLAlchemy 0.8 Documentation

        </title>
        
    <link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
    <link rel="stylesheet" href="../_static/docs.css" type="text/css" />

    <script type="text/javascript">
      var DOCUMENTATION_OPTIONS = {
          URL_ROOT:    '../',
          VERSION:     '0.8.2',
          COLLAPSE_MODINDEX: false,
          FILE_SUFFIX: '.html'
      };
    </script>
        <script type="text/javascript" src="../_static/jquery.js"></script>
        <script type="text/javascript" src="../_static/underscore.js"></script>
        <script type="text/javascript" src="../_static/doctools.js"></script>
    <script type="text/javascript" src="../_static/init.js"></script>
    <link rel="index" title="Index" href="../genindex.html" />
    <link rel="search" title="Search" href="../search.html" />
        <link rel="copyright" title="Copyright" href="../copyright.html" />
    <link rel="top" title="SQLAlchemy 0.8 Documentation" href="../index.html" />
        <link rel="up" title="Dialects" href="index.html" />
        <link rel="next" title="MySQL" href="mysql.html" />
        <link rel="prev" title="Informix" href="informix.html" />

    </head>
    <body>
        










<div id="docs-container">



<div id="docs-header">
    <h1>SQLAlchemy 0.8 Documentation</h1>

    <div id="docs-search">
    Search:
    <form class="search" action="../search.html" method="get">
      <input type="text" name="q" size="18" /> <input type="submit" value="Search" />
      <input type="hidden" name="check_keywords" value="yes" />
      <input type="hidden" name="area" value="default" />
    </form>
    </div>

    <div id="docs-version-header">
        Release: <span class="version-num">0.8.2</span> | Release Date: July 3, 2013


    </div>

</div>

<div id="docs-top-navigation">
    <div id="docs-top-page-control" class="docs-navigation-links">
        <ul>
            <li>Prev:
            <a href="informix.html" title="previous chapter">Informix</a>
            </li>
            <li>Next:
            <a href="mysql.html" title="next chapter">MySQL</a>
            </li>

        <li>
            <a href="../contents.html">Table of Contents</a> |
            <a href="../genindex.html">Index</a>
            | <a href="../_sources/dialects/mssql.txt">view source
        </li>
        </ul>
    </div>

    <div id="docs-navigation-banner">
        <a href="../index.html">SQLAlchemy 0.8 Documentation</a>
                » <a href="index.html" title="Dialects">Dialects</a>
        » 
                Microsoft SQL Server
             

        <h2>
            
                Microsoft SQL Server
            
        </h2>
    </div>

</div>

<div id="docs-body-container">

    <div id="docs-sidebar">
    <h3><a href="../index.html">Table of Contents</a></h3>
    <ul>
<li><a class="reference internal" href="#">Microsoft SQL Server</a><ul>
<li><a class="reference internal" href="#dialect-mssql">Support for the Microsoft SQL Server database.</a></li>
<li><a class="reference internal" href="#auto-increment-behavior">Auto Increment Behavior</a></li>
<li><a class="reference internal" href="#collation-support">Collation Support</a></li>
<li><a class="reference internal" href="#limit-offset-support">LIMIT/OFFSET Support</a></li>
<li><a class="reference internal" href="#nullability">Nullability</a></li>
<li><a class="reference internal" href="#date-time-handling">Date / Time Handling</a></li>
<li><a class="reference internal" href="#mssql-specific-index-options">MSSQL-Specific Index Options</a><ul>
<li><a class="reference internal" href="#clustered">CLUSTERED</a></li>
<li><a class="reference internal" href="#include">INCLUDE</a></li>
<li><a class="reference internal" href="#index-ordering">Index ordering</a></li>
</ul>
</li>
<li><a class="reference internal" href="#compatibility-levels">Compatibility Levels</a></li>
<li><a class="reference internal" href="#triggers">Triggers</a></li>
<li><a class="reference internal" href="#enabling-snapshot-isolation">Enabling Snapshot Isolation</a></li>
<li><a class="reference internal" href="#known-issues">Known Issues</a></li>
<li><a class="reference internal" href="#sql-server-data-types">SQL Server Data Types</a></li>
<li><a class="reference internal" href="#module-sqlalchemy.dialects.mssql.pyodbc">PyODBC</a><ul>
<li><a class="reference internal" href="#dialect-mssql-pyodbc-url">DBAPI</a></li>
<li><a class="reference internal" href="#dialect-mssql-pyodbc-connect">Connecting</a></li>
<li><a class="reference internal" href="#additional-connection-examples">Additional Connection Examples</a></li>
<li><a class="reference internal" href="#unicode-binds">Unicode Binds</a></li>
</ul>
</li>
<li><a class="reference internal" href="#module-sqlalchemy.dialects.mssql.mxodbc">mxODBC</a><ul>
<li><a class="reference internal" href="#dialect-mssql-mxodbc-url">DBAPI</a></li>
<li><a class="reference internal" href="#dialect-mssql-mxodbc-connect">Connecting</a></li>
<li><a class="reference internal" href="#execution-modes">Execution Modes</a></li>
</ul>
</li>
<li><a class="reference internal" href="#module-sqlalchemy.dialects.mssql.pymssql">pymssql</a><ul>
<li><a class="reference internal" href="#dialect-mssql-pymssql-url">DBAPI</a></li>
<li><a class="reference internal" href="#dialect-mssql-pymssql-connect">Connecting</a></li>
<li><a class="reference internal" href="#limitations">Limitations</a></li>
</ul>
</li>
<li><a class="reference internal" href="#module-sqlalchemy.dialects.mssql.zxjdbc">zxjdbc</a><ul>
<li><a class="reference internal" href="#dialect-mssql-zxjdbc-url">DBAPI</a></li>
<li><a class="reference internal" href="#dialect-mssql-zxjdbc-connect">Connecting</a></li>
</ul>
</li>
<li><a class="reference internal" href="#module-sqlalchemy.dialects.mssql.adodbapi">AdoDBAPI</a><ul>
<li><a class="reference internal" href="#dialect-mssql-adodbapi-url">DBAPI</a></li>
<li><a class="reference internal" href="#dialect-mssql-adodbapi-connect">Connecting</a></li>
</ul>
</li>
</ul>
</li>
</ul>


    <h4>Previous Topic</h4>
    <p>
    <a href="informix.html" title="previous chapter">Informix</a>
    </p>
    <h4>Next Topic</h4>
    <p>
    <a href="mysql.html" title="next chapter">MySQL</a>
    </p>


    <h4>Quick Search</h4>
    <p>
    <form class="search" action="../search.html" method="get">
      <input type="text" name="q" size="18" /> <input type="submit" value="Search" />
      <input type="hidden" name="check_keywords" value="yes" />
      <input type="hidden" name="area" value="default" />
    </form>
    </p>

    </div>

    <div id="docs-body" class="withsidebar" >
        
<div class="section" id="module-sqlalchemy.dialects.mssql.base">
<span id="microsoft-sql-server"></span><span id="mssql-toplevel"></span><h1>Microsoft SQL Server<a class="headerlink" href="#module-sqlalchemy.dialects.mssql.base" title="Permalink to this headline">¶</a></h1>
<div class="section" id="dialect-mssql">
<p>Support for the Microsoft SQL Server database.</p>
<h2>DBAPI Support<a class="headerlink" href="#dialect-mssql" title="Permalink to this headline">¶</a></h2>
<p>The following dialect/DBAPI options are available.  Please refer to individual DBAPI sections for connect information.<ul class="simple">
<li><a class="reference external" href="#module-sqlalchemy.dialects.mssql.pyodbc">PyODBC</a></li>
<li><a class="reference external" href="#module-sqlalchemy.dialects.mssql.mxodbc">mxODBC</a></li>
<li><a class="reference external" href="#module-sqlalchemy.dialects.mssql.pymssql">pymssql</a></li>
<li><a class="reference external" href="#module-sqlalchemy.dialects.mssql.zxjdbc">zxJDBC for Jython</a></li>
<li><a class="reference external" href="#module-sqlalchemy.dialects.mssql.adodbapi">adodbapi</a></li>
</ul>
</p>
</div>
<div class="section" id="auto-increment-behavior">
<h2>Auto Increment Behavior<a class="headerlink" href="#auto-increment-behavior" title="Permalink to this headline">¶</a></h2>
<p><tt class="docutils literal"><span class="pre">IDENTITY</span></tt> columns are supported by using SQLAlchemy
<tt class="docutils literal"><span class="pre">schema.Sequence()</span></tt> objects. In other words:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="kn">from</span> <span class="nn">sqlalchemy</span> <span class="kn">import</span> <span class="n">Table</span><span class="p">,</span> <span class="n">Integer</span><span class="p">,</span> <span class="n">Sequence</span><span class="p">,</span> <span class="n">Column</span>

<span class="n">Table</span><span class="p">(</span><span class="s">&#39;test&#39;</span><span class="p">,</span> <span class="n">metadata</span><span class="p">,</span>
       <span class="n">Column</span><span class="p">(</span><span class="s">&#39;id&#39;</span><span class="p">,</span> <span class="n">Integer</span><span class="p">,</span>
              <span class="n">Sequence</span><span class="p">(</span><span class="s">&#39;blah&#39;</span><span class="p">,</span><span class="mi">100</span><span class="p">,</span><span class="mi">10</span><span class="p">),</span> <span class="n">primary_key</span><span class="o">=</span><span class="bp">True</span><span class="p">),</span>
       <span class="n">Column</span><span class="p">(</span><span class="s">&#39;name&#39;</span><span class="p">,</span> <span class="n">String</span><span class="p">(</span><span class="mi">20</span><span class="p">))</span>
     <span class="p">)</span><span class="o">.</span><span class="n">create</span><span class="p">(</span><span class="n">some_engine</span><span class="p">)</span></pre></div>
</div>
<p>would yield:</p>
<div class="highlight-python"><pre>CREATE TABLE test (
  id INTEGER NOT NULL IDENTITY(100,10) PRIMARY KEY,
  name VARCHAR(20) NULL,
  )</pre>
</div>
<p>Note that the <tt class="docutils literal"><span class="pre">start</span></tt> and <tt class="docutils literal"><span class="pre">increment</span></tt> values for sequences are
optional and will default to 1,1.</p>
<p>Implicit <tt class="docutils literal"><span class="pre">autoincrement</span></tt> behavior works the same in MSSQL as it
does in other dialects and results in an <tt class="docutils literal"><span class="pre">IDENTITY</span></tt> column.</p>
<ul class="simple">
<li>Support for <tt class="docutils literal"><span class="pre">SET</span> <span class="pre">IDENTITY_INSERT</span> <span class="pre">ON</span></tt> mode (automagic on / off for
<tt class="docutils literal"><span class="pre">INSERT</span></tt> s)</li>
<li>Support for auto-fetching of <tt class="docutils literal"><span class="pre">&#64;&#64;IDENTITY/&#64;&#64;SCOPE_IDENTITY()</span></tt> on
<tt class="docutils literal"><span class="pre">INSERT</span></tt></li>
</ul>
</div>
<div class="section" id="collation-support">
<h2>Collation Support<a class="headerlink" href="#collation-support" title="Permalink to this headline">¶</a></h2>
<p>Character collations are supported by the base string types,
specified by the string argument &#8220;collation&#8221;:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="kn">from</span> <span class="nn">sqlalchemy</span> <span class="kn">import</span> <span class="n">VARCHAR</span>
<span class="n">Column</span><span class="p">(</span><span class="s">&#39;login&#39;</span><span class="p">,</span> <span class="n">VARCHAR</span><span class="p">(</span><span class="mi">32</span><span class="p">,</span> <span class="n">collation</span><span class="o">=</span><span class="s">&#39;Latin1_General_CI_AS&#39;</span><span class="p">))</span></pre></div>
</div>
<p>When such a column is associated with a <a class="reference internal" href="../core/schema.html#sqlalchemy.schema.Table" title="sqlalchemy.schema.Table"><tt class="xref py py-class docutils literal"><span class="pre">Table</span></tt></a>, the
CREATE TABLE statement for this column will yield:</p>
<div class="highlight-python"><pre>login VARCHAR(32) COLLATE Latin1_General_CI_AS NULL</pre>
</div>
<p class="versionadded">
<span class="versionmodified">New in version 0.8: </span>Character collations are now part of the base string
types.</p>
</div>
<div class="section" id="limit-offset-support">
<h2>LIMIT/OFFSET Support<a class="headerlink" href="#limit-offset-support" title="Permalink to this headline">¶</a></h2>
<p>MSSQL has no support for the LIMIT or OFFSET keysowrds. LIMIT is
supported directly through the <tt class="docutils literal"><span class="pre">TOP</span></tt> Transact SQL keyword:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="n">select</span><span class="o">.</span><span class="n">limit</span></pre></div>
</div>
<p>will yield:</p>
<div class="highlight-python"><pre>SELECT TOP n</pre>
</div>
<p>If using SQL Server 2005 or above, LIMIT with OFFSET
support is available through the <tt class="docutils literal"><span class="pre">ROW_NUMBER</span> <span class="pre">OVER</span></tt> construct.
For versions below 2005, LIMIT with OFFSET usage will fail.</p>
</div>
<div class="section" id="nullability">
<h2>Nullability<a class="headerlink" href="#nullability" title="Permalink to this headline">¶</a></h2>
<p>MSSQL has support for three levels of column nullability. The default
nullability allows nulls and is explicit in the CREATE TABLE
construct:</p>
<div class="highlight-python"><pre>name VARCHAR(20) NULL</pre>
</div>
<p>If <tt class="docutils literal"><span class="pre">nullable=None</span></tt> is specified then no specification is made. In
other words the database&#8217;s configured default is used. This will
render:</p>
<div class="highlight-python"><pre>name VARCHAR(20)</pre>
</div>
<p>If <tt class="docutils literal"><span class="pre">nullable</span></tt> is <tt class="docutils literal"><span class="pre">True</span></tt> or <tt class="docutils literal"><span class="pre">False</span></tt> then the column will be
<tt class="docutils literal"><span class="pre">NULL`</span> <span class="pre">or</span> <span class="pre">``NOT</span> <span class="pre">NULL</span></tt> respectively.</p>
</div>
<div class="section" id="date-time-handling">
<h2>Date / Time Handling<a class="headerlink" href="#date-time-handling" title="Permalink to this headline">¶</a></h2>
<p>DATE and TIME are supported.   Bind parameters are converted
to datetime.datetime() objects as required by most MSSQL drivers,
and results are processed from strings if needed.
The DATE and TIME types are not available for MSSQL 2005 and
previous - if a server version below 2008 is detected, DDL
for these types will be issued as DATETIME.</p>
</div>
<div class="section" id="mssql-specific-index-options">
<span id="mssql-indexes"></span><h2>MSSQL-Specific Index Options<a class="headerlink" href="#mssql-specific-index-options" title="Permalink to this headline">¶</a></h2>
<p>The MSSQL dialect supports special options for <a class="reference internal" href="../core/schema.html#sqlalchemy.schema.Index" title="sqlalchemy.schema.Index"><tt class="xref py py-class docutils literal"><span class="pre">Index</span></tt></a>.</p>
<div class="section" id="clustered">
<h3>CLUSTERED<a class="headerlink" href="#clustered" title="Permalink to this headline">¶</a></h3>
<p>The <tt class="docutils literal"><span class="pre">mssql_clustered</span></tt> option  adds the CLUSTERED keyword to the index:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="n">Index</span><span class="p">(</span><span class="s">&quot;my_index&quot;</span><span class="p">,</span> <span class="n">table</span><span class="o">.</span><span class="n">c</span><span class="o">.</span><span class="n">x</span><span class="p">,</span> <span class="n">mssql_clustered</span><span class="o">=</span><span class="bp">True</span><span class="p">)</span></pre></div>
</div>
<p>would render the index as <tt class="docutils literal"><span class="pre">CREATE</span> <span class="pre">CLUSTERED</span> <span class="pre">INDEX</span> <span class="pre">my_index</span> <span class="pre">ON</span> <span class="pre">table</span> <span class="pre">(x)</span></tt></p>
<p class="versionadded">
<span class="versionmodified">New in version 0.8.</span></p>
</div>
<div class="section" id="include">
<h3>INCLUDE<a class="headerlink" href="#include" title="Permalink to this headline">¶</a></h3>
<p>The <tt class="docutils literal"><span class="pre">mssql_include</span></tt> option renders INCLUDE(colname) for the given string names:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="n">Index</span><span class="p">(</span><span class="s">&quot;my_index&quot;</span><span class="p">,</span> <span class="n">table</span><span class="o">.</span><span class="n">c</span><span class="o">.</span><span class="n">x</span><span class="p">,</span> <span class="n">mssql_include</span><span class="o">=</span><span class="p">[</span><span class="s">&#39;y&#39;</span><span class="p">])</span></pre></div>
</div>
<p>would render the index as <tt class="docutils literal"><span class="pre">CREATE</span> <span class="pre">INDEX</span> <span class="pre">my_index</span> <span class="pre">ON</span> <span class="pre">table</span> <span class="pre">(x)</span> <span class="pre">INCLUDE</span> <span class="pre">(y)</span></tt></p>
<p class="versionadded">
<span class="versionmodified">New in version 0.8.</span></p>
</div>
<div class="section" id="index-ordering">
<h3>Index ordering<a class="headerlink" href="#index-ordering" title="Permalink to this headline">¶</a></h3>
<p>Index ordering is available via functional expressions, such as:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="n">Index</span><span class="p">(</span><span class="s">&quot;my_index&quot;</span><span class="p">,</span> <span class="n">table</span><span class="o">.</span><span class="n">c</span><span class="o">.</span><span class="n">x</span><span class="o">.</span><span class="n">desc</span><span class="p">())</span></pre></div>
</div>
<p>would render the index as <tt class="docutils literal"><span class="pre">CREATE</span> <span class="pre">INDEX</span> <span class="pre">my_index</span> <span class="pre">ON</span> <span class="pre">table</span> <span class="pre">(x</span> <span class="pre">DESC)</span></tt></p>
<p class="versionadded">
<span class="versionmodified">New in version 0.8.</span></p>
<div class="admonition-see-also admonition seealso">
<p class="first admonition-title">See also</p>
<p class="last"><a class="reference internal" href="../core/schema.html#schema-indexes-functional"><em>Functional Indexes</em></a></p>
</div>
</div>
</div>
<div class="section" id="compatibility-levels">
<h2>Compatibility Levels<a class="headerlink" href="#compatibility-levels" title="Permalink to this headline">¶</a></h2>
<p>MSSQL supports the notion of setting compatibility levels at the
database level. This allows, for instance, to run a database that
is compatible with SQL2000 while running on a SQL2005 database
server. <tt class="docutils literal"><span class="pre">server_version_info</span></tt> will always return the database
server version information (in this case SQL2005) and not the
compatibility level information. Because of this, if running under
a backwards compatibility mode SQAlchemy may attempt to use T-SQL
statements that are unable to be parsed by the database server.</p>
</div>
<div class="section" id="triggers">
<h2>Triggers<a class="headerlink" href="#triggers" title="Permalink to this headline">¶</a></h2>
<p>SQLAlchemy by default uses OUTPUT INSERTED to get at newly
generated primary key values via IDENTITY columns or other
server side defaults.   MS-SQL does not
allow the usage of OUTPUT INSERTED on tables that have triggers.
To disable the usage of OUTPUT INSERTED on a per-table basis,
specify <tt class="docutils literal"><span class="pre">implicit_returning=False</span></tt> for each <a class="reference internal" href="../core/schema.html#sqlalchemy.schema.Table" title="sqlalchemy.schema.Table"><tt class="xref py py-class docutils literal"><span class="pre">Table</span></tt></a>
which has triggers:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="n">Table</span><span class="p">(</span><span class="s">&#39;mytable&#39;</span><span class="p">,</span> <span class="n">metadata</span><span class="p">,</span>
    <span class="n">Column</span><span class="p">(</span><span class="s">&#39;id&#39;</span><span class="p">,</span> <span class="n">Integer</span><span class="p">,</span> <span class="n">primary_key</span><span class="o">=</span><span class="bp">True</span><span class="p">),</span>
    <span class="c"># ...,</span>
    <span class="n">implicit_returning</span><span class="o">=</span><span class="bp">False</span>
<span class="p">)</span></pre></div>
</div>
<p>Declarative form:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="k">class</span> <span class="nc">MyClass</span><span class="p">(</span><span class="n">Base</span><span class="p">):</span>
    <span class="c"># ...</span>
    <span class="n">__table_args__</span> <span class="o">=</span> <span class="p">{</span><span class="s">&#39;implicit_returning&#39;</span><span class="p">:</span><span class="bp">False</span><span class="p">}</span></pre></div>
</div>
<p>This option can also be specified engine-wide using the
<tt class="docutils literal"><span class="pre">implicit_returning=False</span></tt> argument on <a class="reference internal" href="../core/engines.html#sqlalchemy.create_engine" title="sqlalchemy.create_engine"><tt class="xref py py-func docutils literal"><span class="pre">create_engine()</span></tt></a>.</p>
</div>
<div class="section" id="enabling-snapshot-isolation">
<h2>Enabling Snapshot Isolation<a class="headerlink" href="#enabling-snapshot-isolation" title="Permalink to this headline">¶</a></h2>
<p>Not necessarily specific to SQLAlchemy, SQL Server has a default transaction
isolation mode that locks entire tables, and causes even mildly concurrent
applications to have long held locks and frequent deadlocks.
Enabling snapshot isolation for the database as a whole is recommended
for modern levels of concurrency support.  This is accomplished via the
following ALTER DATABASE commands executed at the SQL prompt:</p>
<div class="highlight-python"><pre>ALTER DATABASE MyDatabase SET ALLOW_SNAPSHOT_ISOLATION ON

ALTER DATABASE MyDatabase SET READ_COMMITTED_SNAPSHOT ON</pre>
</div>
<p>Background on SQL Server snapshot isolation is available at
<a class="reference external" href="http://msdn.microsoft.com/en-us/library/ms175095.aspx">http://msdn.microsoft.com/en-us/library/ms175095.aspx</a>.</p>
</div>
<div class="section" id="known-issues">
<h2>Known Issues<a class="headerlink" href="#known-issues" title="Permalink to this headline">¶</a></h2>
<ul class="simple">
<li>No support for more than one <tt class="docutils literal"><span class="pre">IDENTITY</span></tt> column per table</li>
<li>reflection of indexes does not work with versions older than
SQL Server 2005</li>
</ul>
</div>
<div class="section" id="sql-server-data-types">
<h2>SQL Server Data Types<a class="headerlink" href="#sql-server-data-types" title="Permalink to this headline">¶</a></h2>
<p>As with all SQLAlchemy dialects, all UPPERCASE types that are known to be
valid with SQL server are importable from the top level dialect, whether
they originate from <a class="reference internal" href="../core/types.html#module-sqlalchemy.types" title="sqlalchemy.types"><tt class="xref py py-mod docutils literal"><span class="pre">sqlalchemy.types</span></tt></a> or from the local dialect:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="kn">from</span> <span class="nn">sqlalchemy.dialects.mssql</span> <span class="kn">import</span> \
    <span class="n">BIGINT</span><span class="p">,</span> <span class="n">BINARY</span><span class="p">,</span> <span class="n">BIT</span><span class="p">,</span> <span class="n">CHAR</span><span class="p">,</span> <span class="n">DATE</span><span class="p">,</span> <span class="n">DATETIME</span><span class="p">,</span> <span class="n">DATETIME2</span><span class="p">,</span> \
    <span class="n">DATETIMEOFFSET</span><span class="p">,</span> <span class="n">DECIMAL</span><span class="p">,</span> <span class="n">FLOAT</span><span class="p">,</span> <span class="n">IMAGE</span><span class="p">,</span> <span class="n">INTEGER</span><span class="p">,</span> <span class="n">MONEY</span><span class="p">,</span> \
    <span class="n">NCHAR</span><span class="p">,</span> <span class="n">NTEXT</span><span class="p">,</span> <span class="n">NUMERIC</span><span class="p">,</span> <span class="n">NVARCHAR</span><span class="p">,</span> <span class="n">REAL</span><span class="p">,</span> <span class="n">SMALLDATETIME</span><span class="p">,</span> \
    <span class="n">SMALLINT</span><span class="p">,</span> <span class="n">SMALLMONEY</span><span class="p">,</span> <span class="n">SQL_VARIANT</span><span class="p">,</span> <span class="n">TEXT</span><span class="p">,</span> <span class="n">TIME</span><span class="p">,</span> \
    <span class="n">TIMESTAMP</span><span class="p">,</span> <span class="n">TINYINT</span><span class="p">,</span> <span class="n">UNIQUEIDENTIFIER</span><span class="p">,</span> <span class="n">VARBINARY</span><span class="p">,</span> <span class="n">VARCHAR</span></pre></div>
</div>
<p>Types which are specific to SQL Server, or have SQL Server-specific
construction arguments, are as follows:</p>
<dl class="class">
<dt id="sqlalchemy.dialects.mssql.BIT">
<em class="property">class </em><tt class="descclassname">sqlalchemy.dialects.mssql.</tt><tt class="descname">BIT</tt><big>(</big><em>*args</em>, <em>**kwargs</em><big>)</big><a class="headerlink" href="#sqlalchemy.dialects.mssql.BIT" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a class="reference internal" href="../core/types.html#sqlalchemy.types.TypeEngine" title="sqlalchemy.types.TypeEngine"><tt class="xref py py-class docutils literal"><span class="pre">sqlalchemy.types.TypeEngine</span></tt></a></p>
<dl class="method">
<dt id="sqlalchemy.dialects.mssql.BIT.__init__">
<tt class="descname">__init__</tt><big>(</big><em>*args</em>, <em>**kwargs</em><big>)</big><a class="headerlink" href="#sqlalchemy.dialects.mssql.BIT.__init__" title="Permalink to this definition">¶</a></dt>
<dd><p>Support implementations that were passing arguments</p>
</dd></dl>

</dd></dl>

<dl class="class">
<dt id="sqlalchemy.dialects.mssql.CHAR">
<em class="property">class </em><tt class="descclassname">sqlalchemy.dialects.mssql.</tt><tt class="descname">CHAR</tt><big>(</big><em>length=None</em>, <em>collation=None</em>, <em>convert_unicode=False</em>, <em>unicode_error=None</em>, <em>_warn_on_bytestring=False</em><big>)</big><a class="headerlink" href="#sqlalchemy.dialects.mssql.CHAR" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a class="reference internal" href="../core/types.html#sqlalchemy.types.String" title="sqlalchemy.types.String"><tt class="xref py py-class docutils literal"><span class="pre">sqlalchemy.types.String</span></tt></a></p>
<p>The SQL CHAR type.</p>
<dl class="method">
<dt id="sqlalchemy.dialects.mssql.CHAR.__init__">
<tt class="descname">__init__</tt><big>(</big><em>length=None</em>, <em>collation=None</em>, <em>convert_unicode=False</em>, <em>unicode_error=None</em>, <em>_warn_on_bytestring=False</em><big>)</big><a class="headerlink" href="#sqlalchemy.dialects.mssql.CHAR.__init__" title="Permalink to this definition">¶</a></dt>
<dd><p>Create a string-holding type.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
<li><strong>length</strong> &#8211; optional, a length for the column for use in
DDL and CAST expressions.  May be safely omitted if no <tt class="docutils literal"><span class="pre">CREATE</span>
<span class="pre">TABLE</span></tt> will be issued.  Certain databases may require a
<tt class="docutils literal"><span class="pre">length</span></tt> for use in DDL, and will raise an exception when
the <tt class="docutils literal"><span class="pre">CREATE</span> <span class="pre">TABLE</span></tt> DDL is issued if a <tt class="docutils literal"><span class="pre">VARCHAR</span></tt>
with no length is included.  Whether the value is
interpreted as bytes or characters is database specific.</li>
<li><strong>collation</strong> &#8211; <p>Optional, a column-level collation for
use in DDL and CAST expressions.  Renders using the
COLLATE keyword supported by SQLite, MySQL, and Postgresql.
E.g.:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sqlalchemy</span> <span class="kn">import</span> <span class="n">cast</span><span class="p">,</span> <span class="n">select</span><span class="p">,</span> <span class="n">String</span>
<span class="gp">&gt;&gt;&gt; </span><span class="k">print</span> <span class="n">select</span><span class="p">([</span><span class="n">cast</span><span class="p">(</span><span class="s">&#39;some string&#39;</span><span class="p">,</span> <span class="n">String</span><span class="p">(</span><span class="n">collation</span><span class="o">=</span><span class="s">&#39;utf8&#39;</span><span class="p">))])</span>
<span class="go">SELECT CAST(:param_1 AS VARCHAR COLLATE utf8) AS anon_1</span></pre></div>
</div>
<p class="versionadded">
<span class="versionmodified">New in version 0.8: </span>Added support for COLLATE to all
string types.</p>
</li>
<li><strong>convert_unicode</strong> &#8211; <p>When set to <tt class="docutils literal"><span class="pre">True</span></tt>, the
<a class="reference internal" href="../core/types.html#sqlalchemy.types.String" title="sqlalchemy.types.String"><tt class="xref py py-class docutils literal"><span class="pre">String</span></tt></a> type will assume that
input is to be passed as Python <tt class="docutils literal"><span class="pre">unicode</span></tt> objects,
and results returned as Python <tt class="docutils literal"><span class="pre">unicode</span></tt> objects.
If the DBAPI in use does not support Python unicode
(which is fewer and fewer these days), SQLAlchemy
will encode/decode the value, using the
value of the <tt class="docutils literal"><span class="pre">encoding</span></tt> parameter passed to
<a class="reference internal" href="../core/engines.html#sqlalchemy.create_engine" title="sqlalchemy.create_engine"><tt class="xref py py-func docutils literal"><span class="pre">create_engine()</span></tt></a> as the encoding.</p>
<p>When using a DBAPI that natively supports Python
unicode objects, this flag generally does not
need to be set.  For columns that are explicitly
intended to store non-ASCII data, the <a class="reference internal" href="../core/types.html#sqlalchemy.types.Unicode" title="sqlalchemy.types.Unicode"><tt class="xref py py-class docutils literal"><span class="pre">Unicode</span></tt></a>
or <tt class="xref py py-class docutils literal"><span class="pre">UnicodeText</span></tt>
types should be used regardless, which feature
the same behavior of <tt class="docutils literal"><span class="pre">convert_unicode</span></tt> but
also indicate an underlying column type that
directly supports unicode, such as <tt class="docutils literal"><span class="pre">NVARCHAR</span></tt>.</p>
<p>For the extremely rare case that Python <tt class="docutils literal"><span class="pre">unicode</span></tt>
is to be encoded/decoded by SQLAlchemy on a backend
that does natively support Python <tt class="docutils literal"><span class="pre">unicode</span></tt>,
the value <tt class="docutils literal"><span class="pre">force</span></tt> can be passed here which will
cause SQLAlchemy&#8217;s encode/decode services to be
used unconditionally.</p>
</li>
<li><strong>unicode_error</strong> &#8211; Optional, a method to use to handle Unicode
conversion errors. Behaves like the <tt class="docutils literal"><span class="pre">errors</span></tt> keyword argument to
the standard library&#8217;s <tt class="docutils literal"><span class="pre">string.decode()</span></tt> functions.   This flag
requires that <tt class="docutils literal"><span class="pre">convert_unicode</span></tt> is set to <tt class="docutils literal"><span class="pre">force</span></tt> - otherwise,
SQLAlchemy is not guaranteed to handle the task of unicode
conversion.   Note that this flag adds significant performance
overhead to row-fetching operations for backends that already
return unicode objects natively (which most DBAPIs do).  This
flag should only be used as a last resort for reading
strings from a column with varied or corrupted encodings.</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>

</dd></dl>

<dl class="class">
<dt id="sqlalchemy.dialects.mssql.DATETIME2">
<em class="property">class </em><tt class="descclassname">sqlalchemy.dialects.mssql.</tt><tt class="descname">DATETIME2</tt><big>(</big><em>precision=None</em>, <em>**kw</em><big>)</big><a class="headerlink" href="#sqlalchemy.dialects.mssql.DATETIME2" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <tt class="xref py py-class docutils literal"><span class="pre">sqlalchemy.dialects.mssql.base._DateTimeBase</span></tt>, <a class="reference internal" href="../core/types.html#sqlalchemy.types.DateTime" title="sqlalchemy.types.DateTime"><tt class="xref py py-class docutils literal"><span class="pre">sqlalchemy.types.DateTime</span></tt></a></p>
</dd></dl>

<dl class="class">
<dt id="sqlalchemy.dialects.mssql.DATETIMEOFFSET">
<em class="property">class </em><tt class="descclassname">sqlalchemy.dialects.mssql.</tt><tt class="descname">DATETIMEOFFSET</tt><big>(</big><em>precision=None</em>, <em>**kwargs</em><big>)</big><a class="headerlink" href="#sqlalchemy.dialects.mssql.DATETIMEOFFSET" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a class="reference internal" href="../core/types.html#sqlalchemy.types.TypeEngine" title="sqlalchemy.types.TypeEngine"><tt class="xref py py-class docutils literal"><span class="pre">sqlalchemy.types.TypeEngine</span></tt></a></p>
</dd></dl>

<dl class="class">
<dt id="sqlalchemy.dialects.mssql.IMAGE">
<em class="property">class </em><tt class="descclassname">sqlalchemy.dialects.mssql.</tt><tt class="descname">IMAGE</tt><big>(</big><em>length=None</em><big>)</big><a class="headerlink" href="#sqlalchemy.dialects.mssql.IMAGE" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a class="reference internal" href="../core/types.html#sqlalchemy.types.LargeBinary" title="sqlalchemy.types.LargeBinary"><tt class="xref py py-class docutils literal"><span class="pre">sqlalchemy.types.LargeBinary</span></tt></a></p>
<dl class="method">
<dt id="sqlalchemy.dialects.mssql.IMAGE.__init__">
<tt class="descname">__init__</tt><big>(</big><em>length=None</em><big>)</big><a class="headerlink" href="#sqlalchemy.dialects.mssql.IMAGE.__init__" title="Permalink to this definition">¶</a></dt>
<dd><p>Construct a LargeBinary type.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>length</strong> &#8211; optional, a length for the column for use in
DDL statements, for those BLOB types that accept a length
(i.e. MySQL).  It does <em>not</em> produce a small BINARY/VARBINARY
type - use the BINARY/VARBINARY types specifically for those.
May be safely omitted if no <tt class="docutils literal"><span class="pre">CREATE</span>
<span class="pre">TABLE</span></tt> will be issued.  Certain databases may require a
<em>length</em> for use in DDL, and will raise an exception when
the <tt class="docutils literal"><span class="pre">CREATE</span> <span class="pre">TABLE</span></tt> DDL is issued.</td>
</tr>
</tbody>
</table>
</dd></dl>

</dd></dl>

<dl class="class">
<dt id="sqlalchemy.dialects.mssql.MONEY">
<em class="property">class </em><tt class="descclassname">sqlalchemy.dialects.mssql.</tt><tt class="descname">MONEY</tt><big>(</big><em>*args</em>, <em>**kwargs</em><big>)</big><a class="headerlink" href="#sqlalchemy.dialects.mssql.MONEY" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a class="reference internal" href="../core/types.html#sqlalchemy.types.TypeEngine" title="sqlalchemy.types.TypeEngine"><tt class="xref py py-class docutils literal"><span class="pre">sqlalchemy.types.TypeEngine</span></tt></a></p>
<dl class="method">
<dt id="sqlalchemy.dialects.mssql.MONEY.__init__">
<tt class="descname">__init__</tt><big>(</big><em>*args</em>, <em>**kwargs</em><big>)</big><a class="headerlink" href="#sqlalchemy.dialects.mssql.MONEY.__init__" title="Permalink to this definition">¶</a></dt>
<dd><p>Support implementations that were passing arguments</p>
</dd></dl>

</dd></dl>

<dl class="class">
<dt id="sqlalchemy.dialects.mssql.NCHAR">
<em class="property">class </em><tt class="descclassname">sqlalchemy.dialects.mssql.</tt><tt class="descname">NCHAR</tt><big>(</big><em>length=None</em>, <em>**kwargs</em><big>)</big><a class="headerlink" href="#sqlalchemy.dialects.mssql.NCHAR" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a class="reference internal" href="../core/types.html#sqlalchemy.types.Unicode" title="sqlalchemy.types.Unicode"><tt class="xref py py-class docutils literal"><span class="pre">sqlalchemy.types.Unicode</span></tt></a></p>
<p>The SQL NCHAR type.</p>
<dl class="method">
<dt id="sqlalchemy.dialects.mssql.NCHAR.__init__">
<tt class="descname">__init__</tt><big>(</big><em>length=None</em>, <em>**kwargs</em><big>)</big><a class="headerlink" href="#sqlalchemy.dialects.mssql.NCHAR.__init__" title="Permalink to this definition">¶</a></dt>
<dd><p>Create a <a class="reference internal" href="../core/types.html#sqlalchemy.types.Unicode" title="sqlalchemy.types.Unicode"><tt class="xref py py-class docutils literal"><span class="pre">Unicode</span></tt></a> object.</p>
<p>Parameters are the same as that of <a class="reference internal" href="../core/types.html#sqlalchemy.types.String" title="sqlalchemy.types.String"><tt class="xref py py-class docutils literal"><span class="pre">String</span></tt></a>,
with the exception that <tt class="docutils literal"><span class="pre">convert_unicode</span></tt>
defaults to <tt class="docutils literal"><span class="pre">True</span></tt>.</p>
</dd></dl>

</dd></dl>

<dl class="class">
<dt id="sqlalchemy.dialects.mssql.NTEXT">
<em class="property">class </em><tt class="descclassname">sqlalchemy.dialects.mssql.</tt><tt class="descname">NTEXT</tt><big>(</big><em>length=None</em>, <em>**kwargs</em><big>)</big><a class="headerlink" href="#sqlalchemy.dialects.mssql.NTEXT" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a class="reference internal" href="../core/types.html#sqlalchemy.types.UnicodeText" title="sqlalchemy.types.UnicodeText"><tt class="xref py py-class docutils literal"><span class="pre">sqlalchemy.types.UnicodeText</span></tt></a></p>
<p>MSSQL NTEXT type, for variable-length unicode text up to 2^30
characters.</p>
<dl class="method">
<dt id="sqlalchemy.dialects.mssql.NTEXT.__init__">
<tt class="descname">__init__</tt><big>(</big><em>length=None</em>, <em>**kwargs</em><big>)</big><a class="headerlink" href="#sqlalchemy.dialects.mssql.NTEXT.__init__" title="Permalink to this definition">¶</a></dt>
<dd><p>Create a Unicode-converting Text type.</p>
<p>Parameters are the same as that of <a class="reference internal" href="../core/types.html#sqlalchemy.types.Text" title="sqlalchemy.types.Text"><tt class="xref py py-class docutils literal"><span class="pre">Text</span></tt></a>,
with the exception that <tt class="docutils literal"><span class="pre">convert_unicode</span></tt>
defaults to <tt class="docutils literal"><span class="pre">True</span></tt>.</p>
</dd></dl>

</dd></dl>

<dl class="class">
<dt id="sqlalchemy.dialects.mssql.NVARCHAR">
<em class="property">class </em><tt class="descclassname">sqlalchemy.dialects.mssql.</tt><tt class="descname">NVARCHAR</tt><big>(</big><em>length=None</em>, <em>**kwargs</em><big>)</big><a class="headerlink" href="#sqlalchemy.dialects.mssql.NVARCHAR" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a class="reference internal" href="../core/types.html#sqlalchemy.types.Unicode" title="sqlalchemy.types.Unicode"><tt class="xref py py-class docutils literal"><span class="pre">sqlalchemy.types.Unicode</span></tt></a></p>
<p>The SQL NVARCHAR type.</p>
<dl class="method">
<dt id="sqlalchemy.dialects.mssql.NVARCHAR.__init__">
<tt class="descname">__init__</tt><big>(</big><em>length=None</em>, <em>**kwargs</em><big>)</big><a class="headerlink" href="#sqlalchemy.dialects.mssql.NVARCHAR.__init__" title="Permalink to this definition">¶</a></dt>
<dd><p>Create a <a class="reference internal" href="../core/types.html#sqlalchemy.types.Unicode" title="sqlalchemy.types.Unicode"><tt class="xref py py-class docutils literal"><span class="pre">Unicode</span></tt></a> object.</p>
<p>Parameters are the same as that of <a class="reference internal" href="../core/types.html#sqlalchemy.types.String" title="sqlalchemy.types.String"><tt class="xref py py-class docutils literal"><span class="pre">String</span></tt></a>,
with the exception that <tt class="docutils literal"><span class="pre">convert_unicode</span></tt>
defaults to <tt class="docutils literal"><span class="pre">True</span></tt>.</p>
</dd></dl>

</dd></dl>

<dl class="class">
<dt id="sqlalchemy.dialects.mssql.REAL">
<em class="property">class </em><tt class="descclassname">sqlalchemy.dialects.mssql.</tt><tt class="descname">REAL</tt><big>(</big><em>**kw</em><big>)</big><a class="headerlink" href="#sqlalchemy.dialects.mssql.REAL" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a class="reference internal" href="../core/types.html#sqlalchemy.types.REAL" title="sqlalchemy.types.REAL"><tt class="xref py py-class docutils literal"><span class="pre">sqlalchemy.types.REAL</span></tt></a></p>
</dd></dl>

<dl class="class">
<dt id="sqlalchemy.dialects.mssql.SMALLDATETIME">
<em class="property">class </em><tt class="descclassname">sqlalchemy.dialects.mssql.</tt><tt class="descname">SMALLDATETIME</tt><big>(</big><em>timezone=False</em><big>)</big><a class="headerlink" href="#sqlalchemy.dialects.mssql.SMALLDATETIME" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <tt class="xref py py-class docutils literal"><span class="pre">sqlalchemy.dialects.mssql.base._DateTimeBase</span></tt>, <a class="reference internal" href="../core/types.html#sqlalchemy.types.DateTime" title="sqlalchemy.types.DateTime"><tt class="xref py py-class docutils literal"><span class="pre">sqlalchemy.types.DateTime</span></tt></a></p>
<dl class="method">
<dt id="sqlalchemy.dialects.mssql.SMALLDATETIME.__init__">
<tt class="descname">__init__</tt><big>(</big><em>timezone=False</em><big>)</big><a class="headerlink" href="#sqlalchemy.dialects.mssql.SMALLDATETIME.__init__" title="Permalink to this definition">¶</a></dt>
<dd><p>Construct a new <a class="reference internal" href="../core/types.html#sqlalchemy.types.DateTime" title="sqlalchemy.types.DateTime"><tt class="xref py py-class docutils literal"><span class="pre">DateTime</span></tt></a>.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>timezone</strong> &#8211; boolean.  If True, and supported by the</td>
</tr>
</tbody>
</table>
<p>backend, will produce &#8216;TIMESTAMP WITH TIMEZONE&#8217;. For backends
that don&#8217;t support timezone aware timestamps, has no
effect.</p>
</dd></dl>

</dd></dl>

<dl class="class">
<dt id="sqlalchemy.dialects.mssql.SMALLMONEY">
<em class="property">class </em><tt class="descclassname">sqlalchemy.dialects.mssql.</tt><tt class="descname">SMALLMONEY</tt><big>(</big><em>*args</em>, <em>**kwargs</em><big>)</big><a class="headerlink" href="#sqlalchemy.dialects.mssql.SMALLMONEY" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a class="reference internal" href="../core/types.html#sqlalchemy.types.TypeEngine" title="sqlalchemy.types.TypeEngine"><tt class="xref py py-class docutils literal"><span class="pre">sqlalchemy.types.TypeEngine</span></tt></a></p>
<dl class="method">
<dt id="sqlalchemy.dialects.mssql.SMALLMONEY.__init__">
<tt class="descname">__init__</tt><big>(</big><em>*args</em>, <em>**kwargs</em><big>)</big><a class="headerlink" href="#sqlalchemy.dialects.mssql.SMALLMONEY.__init__" title="Permalink to this definition">¶</a></dt>
<dd><p>Support implementations that were passing arguments</p>
</dd></dl>

</dd></dl>

<dl class="class">
<dt id="sqlalchemy.dialects.mssql.SQL_VARIANT">
<em class="property">class </em><tt class="descclassname">sqlalchemy.dialects.mssql.</tt><tt class="descname">SQL_VARIANT</tt><big>(</big><em>*args</em>, <em>**kwargs</em><big>)</big><a class="headerlink" href="#sqlalchemy.dialects.mssql.SQL_VARIANT" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a class="reference internal" href="../core/types.html#sqlalchemy.types.TypeEngine" title="sqlalchemy.types.TypeEngine"><tt class="xref py py-class docutils literal"><span class="pre">sqlalchemy.types.TypeEngine</span></tt></a></p>
<dl class="method">
<dt id="sqlalchemy.dialects.mssql.SQL_VARIANT.__init__">
<tt class="descname">__init__</tt><big>(</big><em>*args</em>, <em>**kwargs</em><big>)</big><a class="headerlink" href="#sqlalchemy.dialects.mssql.SQL_VARIANT.__init__" title="Permalink to this definition">¶</a></dt>
<dd><p>Support implementations that were passing arguments</p>
</dd></dl>

</dd></dl>

<dl class="class">
<dt id="sqlalchemy.dialects.mssql.TEXT">
<em class="property">class </em><tt class="descclassname">sqlalchemy.dialects.mssql.</tt><tt class="descname">TEXT</tt><big>(</big><em>length=None</em>, <em>collation=None</em>, <em>convert_unicode=False</em>, <em>unicode_error=None</em>, <em>_warn_on_bytestring=False</em><big>)</big><a class="headerlink" href="#sqlalchemy.dialects.mssql.TEXT" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a class="reference internal" href="../core/types.html#sqlalchemy.types.Text" title="sqlalchemy.types.Text"><tt class="xref py py-class docutils literal"><span class="pre">sqlalchemy.types.Text</span></tt></a></p>
<p>The SQL TEXT type.</p>
<dl class="method">
<dt id="sqlalchemy.dialects.mssql.TEXT.__init__">
<tt class="descname">__init__</tt><big>(</big><em>length=None</em>, <em>collation=None</em>, <em>convert_unicode=False</em>, <em>unicode_error=None</em>, <em>_warn_on_bytestring=False</em><big>)</big><a class="headerlink" href="#sqlalchemy.dialects.mssql.TEXT.__init__" title="Permalink to this definition">¶</a></dt>
<dd><p>Create a string-holding type.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
<li><strong>length</strong> &#8211; optional, a length for the column for use in
DDL and CAST expressions.  May be safely omitted if no <tt class="docutils literal"><span class="pre">CREATE</span>
<span class="pre">TABLE</span></tt> will be issued.  Certain databases may require a
<tt class="docutils literal"><span class="pre">length</span></tt> for use in DDL, and will raise an exception when
the <tt class="docutils literal"><span class="pre">CREATE</span> <span class="pre">TABLE</span></tt> DDL is issued if a <tt class="docutils literal"><span class="pre">VARCHAR</span></tt>
with no length is included.  Whether the value is
interpreted as bytes or characters is database specific.</li>
<li><strong>collation</strong> &#8211; <p>Optional, a column-level collation for
use in DDL and CAST expressions.  Renders using the
COLLATE keyword supported by SQLite, MySQL, and Postgresql.
E.g.:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sqlalchemy</span> <span class="kn">import</span> <span class="n">cast</span><span class="p">,</span> <span class="n">select</span><span class="p">,</span> <span class="n">String</span>
<span class="gp">&gt;&gt;&gt; </span><span class="k">print</span> <span class="n">select</span><span class="p">([</span><span class="n">cast</span><span class="p">(</span><span class="s">&#39;some string&#39;</span><span class="p">,</span> <span class="n">String</span><span class="p">(</span><span class="n">collation</span><span class="o">=</span><span class="s">&#39;utf8&#39;</span><span class="p">))])</span>
<span class="go">SELECT CAST(:param_1 AS VARCHAR COLLATE utf8) AS anon_1</span></pre></div>
</div>
<p class="versionadded">
<span class="versionmodified">New in version 0.8: </span>Added support for COLLATE to all
string types.</p>
</li>
<li><strong>convert_unicode</strong> &#8211; <p>When set to <tt class="docutils literal"><span class="pre">True</span></tt>, the
<a class="reference internal" href="../core/types.html#sqlalchemy.types.String" title="sqlalchemy.types.String"><tt class="xref py py-class docutils literal"><span class="pre">String</span></tt></a> type will assume that
input is to be passed as Python <tt class="docutils literal"><span class="pre">unicode</span></tt> objects,
and results returned as Python <tt class="docutils literal"><span class="pre">unicode</span></tt> objects.
If the DBAPI in use does not support Python unicode
(which is fewer and fewer these days), SQLAlchemy
will encode/decode the value, using the
value of the <tt class="docutils literal"><span class="pre">encoding</span></tt> parameter passed to
<a class="reference internal" href="../core/engines.html#sqlalchemy.create_engine" title="sqlalchemy.create_engine"><tt class="xref py py-func docutils literal"><span class="pre">create_engine()</span></tt></a> as the encoding.</p>
<p>When using a DBAPI that natively supports Python
unicode objects, this flag generally does not
need to be set.  For columns that are explicitly
intended to store non-ASCII data, the <a class="reference internal" href="../core/types.html#sqlalchemy.types.Unicode" title="sqlalchemy.types.Unicode"><tt class="xref py py-class docutils literal"><span class="pre">Unicode</span></tt></a>
or <tt class="xref py py-class docutils literal"><span class="pre">UnicodeText</span></tt>
types should be used regardless, which feature
the same behavior of <tt class="docutils literal"><span class="pre">convert_unicode</span></tt> but
also indicate an underlying column type that
directly supports unicode, such as <tt class="docutils literal"><span class="pre">NVARCHAR</span></tt>.</p>
<p>For the extremely rare case that Python <tt class="docutils literal"><span class="pre">unicode</span></tt>
is to be encoded/decoded by SQLAlchemy on a backend
that does natively support Python <tt class="docutils literal"><span class="pre">unicode</span></tt>,
the value <tt class="docutils literal"><span class="pre">force</span></tt> can be passed here which will
cause SQLAlchemy&#8217;s encode/decode services to be
used unconditionally.</p>
</li>
<li><strong>unicode_error</strong> &#8211; Optional, a method to use to handle Unicode
conversion errors. Behaves like the <tt class="docutils literal"><span class="pre">errors</span></tt> keyword argument to
the standard library&#8217;s <tt class="docutils literal"><span class="pre">string.decode()</span></tt> functions.   This flag
requires that <tt class="docutils literal"><span class="pre">convert_unicode</span></tt> is set to <tt class="docutils literal"><span class="pre">force</span></tt> - otherwise,
SQLAlchemy is not guaranteed to handle the task of unicode
conversion.   Note that this flag adds significant performance
overhead to row-fetching operations for backends that already
return unicode objects natively (which most DBAPIs do).  This
flag should only be used as a last resort for reading
strings from a column with varied or corrupted encodings.</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>

</dd></dl>

<dl class="class">
<dt id="sqlalchemy.dialects.mssql.TIME">
<em class="property">class </em><tt class="descclassname">sqlalchemy.dialects.mssql.</tt><tt class="descname">TIME</tt><big>(</big><em>precision=None</em>, <em>**kwargs</em><big>)</big><a class="headerlink" href="#sqlalchemy.dialects.mssql.TIME" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a class="reference internal" href="../core/types.html#sqlalchemy.types.TIME" title="sqlalchemy.types.TIME"><tt class="xref py py-class docutils literal"><span class="pre">sqlalchemy.types.TIME</span></tt></a></p>
</dd></dl>

<dl class="class">
<dt id="sqlalchemy.dialects.mssql.TINYINT">
<em class="property">class </em><tt class="descclassname">sqlalchemy.dialects.mssql.</tt><tt class="descname">TINYINT</tt><big>(</big><em>*args</em>, <em>**kwargs</em><big>)</big><a class="headerlink" href="#sqlalchemy.dialects.mssql.TINYINT" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a class="reference internal" href="../core/types.html#sqlalchemy.types.Integer" title="sqlalchemy.types.Integer"><tt class="xref py py-class docutils literal"><span class="pre">sqlalchemy.types.Integer</span></tt></a></p>
<dl class="method">
<dt id="sqlalchemy.dialects.mssql.TINYINT.__init__">
<tt class="descname">__init__</tt><big>(</big><em>*args</em>, <em>**kwargs</em><big>)</big><a class="headerlink" href="#sqlalchemy.dialects.mssql.TINYINT.__init__" title="Permalink to this definition">¶</a></dt>
<dd><p>Support implementations that were passing arguments</p>
</dd></dl>

</dd></dl>

<dl class="class">
<dt id="sqlalchemy.dialects.mssql.UNIQUEIDENTIFIER">
<em class="property">class </em><tt class="descclassname">sqlalchemy.dialects.mssql.</tt><tt class="descname">UNIQUEIDENTIFIER</tt><big>(</big><em>*args</em>, <em>**kwargs</em><big>)</big><a class="headerlink" href="#sqlalchemy.dialects.mssql.UNIQUEIDENTIFIER" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a class="reference internal" href="../core/types.html#sqlalchemy.types.TypeEngine" title="sqlalchemy.types.TypeEngine"><tt class="xref py py-class docutils literal"><span class="pre">sqlalchemy.types.TypeEngine</span></tt></a></p>
<dl class="method">
<dt id="sqlalchemy.dialects.mssql.UNIQUEIDENTIFIER.__init__">
<tt class="descname">__init__</tt><big>(</big><em>*args</em>, <em>**kwargs</em><big>)</big><a class="headerlink" href="#sqlalchemy.dialects.mssql.UNIQUEIDENTIFIER.__init__" title="Permalink to this definition">¶</a></dt>
<dd><p>Support implementations that were passing arguments</p>
</dd></dl>

</dd></dl>

<dl class="class">
<dt id="sqlalchemy.dialects.mssql.VARCHAR">
<em class="property">class </em><tt class="descclassname">sqlalchemy.dialects.mssql.</tt><tt class="descname">VARCHAR</tt><big>(</big><em>length=None</em>, <em>collation=None</em>, <em>convert_unicode=False</em>, <em>unicode_error=None</em>, <em>_warn_on_bytestring=False</em><big>)</big><a class="headerlink" href="#sqlalchemy.dialects.mssql.VARCHAR" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a class="reference internal" href="../core/types.html#sqlalchemy.types.String" title="sqlalchemy.types.String"><tt class="xref py py-class docutils literal"><span class="pre">sqlalchemy.types.String</span></tt></a></p>
<p>The SQL VARCHAR type.</p>
<dl class="method">
<dt id="sqlalchemy.dialects.mssql.VARCHAR.__init__">
<tt class="descname">__init__</tt><big>(</big><em>length=None</em>, <em>collation=None</em>, <em>convert_unicode=False</em>, <em>unicode_error=None</em>, <em>_warn_on_bytestring=False</em><big>)</big><a class="headerlink" href="#sqlalchemy.dialects.mssql.VARCHAR.__init__" title="Permalink to this definition">¶</a></dt>
<dd><p>Create a string-holding type.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
<li><strong>length</strong> &#8211; optional, a length for the column for use in
DDL and CAST expressions.  May be safely omitted if no <tt class="docutils literal"><span class="pre">CREATE</span>
<span class="pre">TABLE</span></tt> will be issued.  Certain databases may require a
<tt class="docutils literal"><span class="pre">length</span></tt> for use in DDL, and will raise an exception when
the <tt class="docutils literal"><span class="pre">CREATE</span> <span class="pre">TABLE</span></tt> DDL is issued if a <tt class="docutils literal"><span class="pre">VARCHAR</span></tt>
with no length is included.  Whether the value is
interpreted as bytes or characters is database specific.</li>
<li><strong>collation</strong> &#8211; <p>Optional, a column-level collation for
use in DDL and CAST expressions.  Renders using the
COLLATE keyword supported by SQLite, MySQL, and Postgresql.
E.g.:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sqlalchemy</span> <span class="kn">import</span> <span class="n">cast</span><span class="p">,</span> <span class="n">select</span><span class="p">,</span> <span class="n">String</span>
<span class="gp">&gt;&gt;&gt; </span><span class="k">print</span> <span class="n">select</span><span class="p">([</span><span class="n">cast</span><span class="p">(</span><span class="s">&#39;some string&#39;</span><span class="p">,</span> <span class="n">String</span><span class="p">(</span><span class="n">collation</span><span class="o">=</span><span class="s">&#39;utf8&#39;</span><span class="p">))])</span>
<span class="go">SELECT CAST(:param_1 AS VARCHAR COLLATE utf8) AS anon_1</span></pre></div>
</div>
<p class="versionadded">
<span class="versionmodified">New in version 0.8: </span>Added support for COLLATE to all
string types.</p>
</li>
<li><strong>convert_unicode</strong> &#8211; <p>When set to <tt class="docutils literal"><span class="pre">True</span></tt>, the
<a class="reference internal" href="../core/types.html#sqlalchemy.types.String" title="sqlalchemy.types.String"><tt class="xref py py-class docutils literal"><span class="pre">String</span></tt></a> type will assume that
input is to be passed as Python <tt class="docutils literal"><span class="pre">unicode</span></tt> objects,
and results returned as Python <tt class="docutils literal"><span class="pre">unicode</span></tt> objects.
If the DBAPI in use does not support Python unicode
(which is fewer and fewer these days), SQLAlchemy
will encode/decode the value, using the
value of the <tt class="docutils literal"><span class="pre">encoding</span></tt> parameter passed to
<a class="reference internal" href="../core/engines.html#sqlalchemy.create_engine" title="sqlalchemy.create_engine"><tt class="xref py py-func docutils literal"><span class="pre">create_engine()</span></tt></a> as the encoding.</p>
<p>When using a DBAPI that natively supports Python
unicode objects, this flag generally does not
need to be set.  For columns that are explicitly
intended to store non-ASCII data, the <a class="reference internal" href="../core/types.html#sqlalchemy.types.Unicode" title="sqlalchemy.types.Unicode"><tt class="xref py py-class docutils literal"><span class="pre">Unicode</span></tt></a>
or <tt class="xref py py-class docutils literal"><span class="pre">UnicodeText</span></tt>
types should be used regardless, which feature
the same behavior of <tt class="docutils literal"><span class="pre">convert_unicode</span></tt> but
also indicate an underlying column type that
directly supports unicode, such as <tt class="docutils literal"><span class="pre">NVARCHAR</span></tt>.</p>
<p>For the extremely rare case that Python <tt class="docutils literal"><span class="pre">unicode</span></tt>
is to be encoded/decoded by SQLAlchemy on a backend
that does natively support Python <tt class="docutils literal"><span class="pre">unicode</span></tt>,
the value <tt class="docutils literal"><span class="pre">force</span></tt> can be passed here which will
cause SQLAlchemy&#8217;s encode/decode services to be
used unconditionally.</p>
</li>
<li><strong>unicode_error</strong> &#8211; Optional, a method to use to handle Unicode
conversion errors. Behaves like the <tt class="docutils literal"><span class="pre">errors</span></tt> keyword argument to
the standard library&#8217;s <tt class="docutils literal"><span class="pre">string.decode()</span></tt> functions.   This flag
requires that <tt class="docutils literal"><span class="pre">convert_unicode</span></tt> is set to <tt class="docutils literal"><span class="pre">force</span></tt> - otherwise,
SQLAlchemy is not guaranteed to handle the task of unicode
conversion.   Note that this flag adds significant performance
overhead to row-fetching operations for backends that already
return unicode objects natively (which most DBAPIs do).  This
flag should only be used as a last resort for reading
strings from a column with varied or corrupted encodings.</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>

</dd></dl>

</div>
<div class="section" id="module-sqlalchemy.dialects.mssql.pyodbc">
<span id="pyodbc"></span><h2>PyODBC<a class="headerlink" href="#module-sqlalchemy.dialects.mssql.pyodbc" title="Permalink to this headline">¶</a></h2>
<p>Support for the Microsoft SQL Server database via the PyODBC driver.</p>
<div class="section" id="dialect-mssql-pyodbc-url">
<h3>DBAPI<a class="headerlink" href="#dialect-mssql-pyodbc-url" title="Permalink to this headline">¶</a></h3>
<p>Documentation and download information (if applicable) for PyODBC is available at:
<a class="reference external" href="http://pypi.python.org/pypi/pyodbc/">http://pypi.python.org/pypi/pyodbc/</a></p>
</div>
<div class="section" id="dialect-mssql-pyodbc-connect">
<h3>Connecting<a class="headerlink" href="#dialect-mssql-pyodbc-connect" title="Permalink to this headline">¶</a></h3>
<p>Connect String:<div class="highlight-python"><pre>mssql+pyodbc://&lt;username&gt;:&lt;password&gt;@&lt;dsnname&gt;</pre>
</div>
</p>
</div>
<div class="section" id="additional-connection-examples">
<h3>Additional Connection Examples<a class="headerlink" href="#additional-connection-examples" title="Permalink to this headline">¶</a></h3>
<p>Examples of pyodbc connection string URLs:</p>
<ul>
<li><p class="first"><tt class="docutils literal"><span class="pre">mssql+pyodbc://mydsn</span></tt> - connects using the specified DSN named <tt class="docutils literal"><span class="pre">mydsn</span></tt>.
The connection string that is created will appear like:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="n">dsn</span><span class="o">=</span><span class="n">mydsn</span><span class="p">;</span><span class="n">Trusted_Connection</span><span class="o">=</span><span class="n">Yes</span></pre></div>
</div>
</li>
<li><p class="first"><tt class="docutils literal"><span class="pre">mssql+pyodbc://user:pass&#64;mydsn</span></tt> - connects using the DSN named
<tt class="docutils literal"><span class="pre">mydsn</span></tt> passing in the <tt class="docutils literal"><span class="pre">UID</span></tt> and <tt class="docutils literal"><span class="pre">PWD</span></tt> information. The
connection string that is created will appear like:</p>
<div class="highlight-python"><pre>dsn=mydsn;UID=user;PWD=pass</pre>
</div>
</li>
<li><p class="first"><tt class="docutils literal"><span class="pre">mssql+pyodbc://user:pass&#64;mydsn/?LANGUAGE=us_english</span></tt> - connects
using the DSN named <tt class="docutils literal"><span class="pre">mydsn</span></tt> passing in the <tt class="docutils literal"><span class="pre">UID</span></tt> and <tt class="docutils literal"><span class="pre">PWD</span></tt>
information, plus the additional connection configuration option
<tt class="docutils literal"><span class="pre">LANGUAGE</span></tt>. The connection string that is created will appear
like:</p>
<div class="highlight-python"><pre>dsn=mydsn;UID=user;PWD=pass;LANGUAGE=us_english</pre>
</div>
</li>
<li><p class="first"><tt class="docutils literal"><span class="pre">mssql+pyodbc://user:pass&#64;host/db</span></tt> - connects using a connection
that would appear like:</p>
<div class="highlight-python"><pre>DRIVER={SQL Server};Server=host;Database=db;UID=user;PWD=pass</pre>
</div>
</li>
<li><p class="first"><tt class="docutils literal"><span class="pre">mssql+pyodbc://user:pass&#64;host:123/db</span></tt> - connects using a connection
string which includes the port
information using the comma syntax. This will create the following
connection string:</p>
<div class="highlight-python"><pre>DRIVER={SQL Server};Server=host,123;Database=db;UID=user;PWD=pass</pre>
</div>
</li>
<li><p class="first"><tt class="docutils literal"><span class="pre">mssql+pyodbc://user:pass&#64;host/db?port=123</span></tt> - connects using a connection
string that includes the port
information as a separate <tt class="docutils literal"><span class="pre">port</span></tt> keyword. This will create the
following connection string:</p>
<div class="highlight-python"><pre>DRIVER={SQL Server};Server=host;Database=db;UID=user;PWD=pass;port=123</pre>
</div>
</li>
<li><p class="first"><tt class="docutils literal"><span class="pre">mssql+pyodbc://user:pass&#64;host/db?driver=MyDriver</span></tt> - connects using a connection
string that includes a custom
ODBC driver name.  This will create the following connection string:</p>
<div class="highlight-python"><pre>DRIVER={MyDriver};Server=host;Database=db;UID=user;PWD=pass</pre>
</div>
</li>
</ul>
<p>If you require a connection string that is outside the options
presented above, use the <tt class="docutils literal"><span class="pre">odbc_connect</span></tt> keyword to pass in a
urlencoded connection string. What gets passed in will be urldecoded
and passed directly.</p>
<p>For example:</p>
<div class="highlight-python"><pre>mssql+pyodbc:///?odbc_connect=dsn%3Dmydsn%3BDatabase%3Ddb</pre>
</div>
<p>would create the following connection string:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="n">dsn</span><span class="o">=</span><span class="n">mydsn</span><span class="p">;</span><span class="n">Database</span><span class="o">=</span><span class="n">db</span></pre></div>
</div>
<p>Encoding your connection string can be easily accomplished through
the python shell. For example:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="kn">import</span> <span class="nn">urllib</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">urllib</span><span class="o">.</span><span class="n">quote_plus</span><span class="p">(</span><span class="s">&#39;dsn=mydsn;Database=db&#39;</span><span class="p">)</span>
<span class="go">&#39;dsn%3Dmydsn%3BDatabase%3Ddb&#39;</span></pre></div>
</div>
</div>
<div class="section" id="unicode-binds">
<h3>Unicode Binds<a class="headerlink" href="#unicode-binds" title="Permalink to this headline">¶</a></h3>
<p>The current state of PyODBC on a unix backend with FreeTDS and/or
EasySoft is poor regarding unicode; different OS platforms and versions of UnixODBC
versus IODBC versus FreeTDS/EasySoft versus PyODBC itself dramatically
alter how strings are received.  The PyODBC dialect attempts to use all the information
it knows to determine whether or not a Python unicode literal can be
passed directly to the PyODBC driver or not; while SQLAlchemy can encode
these to bytestrings first, some users have reported that PyODBC mis-handles
bytestrings for certain encodings and requires a Python unicode object,
while the author has observed widespread cases where a Python unicode
is completely misinterpreted by PyODBC, particularly when dealing with
the information schema tables used in table reflection, and the value
must first be encoded to a bytestring.</p>
<p>It is for this reason that whether or not unicode literals for bound
parameters be sent to PyODBC can be controlled using the
<tt class="docutils literal"><span class="pre">supports_unicode_binds</span></tt> parameter to <tt class="docutils literal"><span class="pre">create_engine()</span></tt>.  When
left at its default of <tt class="docutils literal"><span class="pre">None</span></tt>, the PyODBC dialect will use its
best guess as to whether or not the driver deals with unicode literals
well.  When <tt class="docutils literal"><span class="pre">False</span></tt>, unicode literals will be encoded first, and when
<tt class="docutils literal"><span class="pre">True</span></tt> unicode literals will be passed straight through.  This is an interim
flag that hopefully should not be needed when the unicode situation stabilizes
for unix + PyODBC.</p>
<p class="versionadded">
<span class="versionmodified">New in version 0.7.7: </span><tt class="docutils literal"><span class="pre">supports_unicode_binds</span></tt> parameter to <tt class="docutils literal"><span class="pre">create_engine()</span></tt>.</p>
</div>
</div>
<div class="section" id="module-sqlalchemy.dialects.mssql.mxodbc">
<span id="mxodbc"></span><h2>mxODBC<a class="headerlink" href="#module-sqlalchemy.dialects.mssql.mxodbc" title="Permalink to this headline">¶</a></h2>
<p>Support for the Microsoft SQL Server database via the mxODBC driver.</p>
<div class="section" id="dialect-mssql-mxodbc-url">
<h3>DBAPI<a class="headerlink" href="#dialect-mssql-mxodbc-url" title="Permalink to this headline">¶</a></h3>
<p>Documentation and download information (if applicable) for mxODBC is available at:
<a class="reference external" href="http://www.egenix.com/">http://www.egenix.com/</a></p>
</div>
<div class="section" id="dialect-mssql-mxodbc-connect">
<h3>Connecting<a class="headerlink" href="#dialect-mssql-mxodbc-connect" title="Permalink to this headline">¶</a></h3>
<p>Connect String:<div class="highlight-python"><pre>mssql+mxodbc://&lt;username&gt;:&lt;password&gt;@&lt;dsnname&gt;</pre>
</div>
</p>
</div>
<div class="section" id="execution-modes">
<h3>Execution Modes<a class="headerlink" href="#execution-modes" title="Permalink to this headline">¶</a></h3>
<p>mxODBC features two styles of statement execution, using the
<tt class="docutils literal"><span class="pre">cursor.execute()</span></tt> and <tt class="docutils literal"><span class="pre">cursor.executedirect()</span></tt> methods (the second being
an extension to the DBAPI specification). The former makes use of a particular
API call specific to the SQL Server Native Client ODBC driver known
SQLDescribeParam, while the latter does not.</p>
<p>mxODBC apparently only makes repeated use of a single prepared statement
when SQLDescribeParam is used. The advantage to prepared statement reuse is
one of performance. The disadvantage is that SQLDescribeParam has a limited
set of scenarios in which bind parameters are understood, including that they
cannot be placed within the argument lists of function calls, anywhere outside
the FROM, or even within subqueries within the FROM clause - making the usage
of bind parameters within SELECT statements impossible for all but the most
simplistic statements.</p>
<p>For this reason, the mxODBC dialect uses the &#8220;native&#8221; mode by default only for
INSERT, UPDATE, and DELETE statements, and uses the escaped string mode for
all other statements.</p>
<p>This behavior can be controlled via
<a class="reference internal" href="../core/expression_api.html#sqlalchemy.sql.expression.Executable.execution_options" title="sqlalchemy.sql.expression.Executable.execution_options"><tt class="xref py py-meth docutils literal"><span class="pre">execution_options()</span></tt></a> using the
<tt class="docutils literal"><span class="pre">native_odbc_execute</span></tt> flag with a value of <tt class="docutils literal"><span class="pre">True</span></tt> or <tt class="docutils literal"><span class="pre">False</span></tt>, where a
value of <tt class="docutils literal"><span class="pre">True</span></tt> will unconditionally use native bind parameters and a value
of <tt class="docutils literal"><span class="pre">False</span></tt> will unconditionally use string-escaped parameters.</p>
</div>
</div>
<div class="section" id="module-sqlalchemy.dialects.mssql.pymssql">
<span id="pymssql"></span><h2>pymssql<a class="headerlink" href="#module-sqlalchemy.dialects.mssql.pymssql" title="Permalink to this headline">¶</a></h2>
<p>Support for the Microsoft SQL Server database via the pymssql driver.</p>
<div class="section" id="dialect-mssql-pymssql-url">
<h3>DBAPI<a class="headerlink" href="#dialect-mssql-pymssql-url" title="Permalink to this headline">¶</a></h3>
<p>Documentation and download information (if applicable) for pymssql is available at:
<a class="reference external" href="http://pymssql.sourceforge.net/">http://pymssql.sourceforge.net/</a></p>
</div>
<div class="section" id="dialect-mssql-pymssql-connect">
<h3>Connecting<a class="headerlink" href="#dialect-mssql-pymssql-connect" title="Permalink to this headline">¶</a></h3>
<p>Connect String:<div class="highlight-python"><pre>mssql+pymssql://&lt;username&gt;:&lt;password&gt;@&lt;freetds_name&gt;?charset=utf8</pre>
</div>
</p>
</div>
<div class="section" id="limitations">
<h3>Limitations<a class="headerlink" href="#limitations" title="Permalink to this headline">¶</a></h3>
<p>pymssql inherits a lot of limitations from FreeTDS, including:</p>
<ul class="simple">
<li>no support for multibyte schema identifiers</li>
<li>poor support for large decimals</li>
<li>poor support for binary fields</li>
<li>poor support for VARCHAR/CHAR fields over 255 characters</li>
</ul>
<p>Please consult the pymssql documentation for further information.</p>
</div>
</div>
<div class="section" id="module-sqlalchemy.dialects.mssql.zxjdbc">
<span id="zxjdbc"></span><h2>zxjdbc<a class="headerlink" href="#module-sqlalchemy.dialects.mssql.zxjdbc" title="Permalink to this headline">¶</a></h2>
<p>Support for the Microsoft SQL Server database via the zxJDBC for Jython driver.</p>
<div class="section" id="dialect-mssql-zxjdbc-url">
<h3>DBAPI<a class="headerlink" href="#dialect-mssql-zxjdbc-url" title="Permalink to this headline">¶</a></h3>
<p>Drivers for this database are available at:
<a class="reference external" href="http://jtds.sourceforge.net/">http://jtds.sourceforge.net/</a></p>
</div>
<div class="section" id="dialect-mssql-zxjdbc-connect">
<h3>Connecting<a class="headerlink" href="#dialect-mssql-zxjdbc-connect" title="Permalink to this headline">¶</a></h3>
<p>Connect String:<div class="highlight-python"><pre>mssql+zxjdbc://user:pass@host:port/dbname[?key=value&amp;key=value...]</pre>
</div>
</p>
</div>
</div>
<div class="section" id="module-sqlalchemy.dialects.mssql.adodbapi">
<span id="adodbapi"></span><h2>AdoDBAPI<a class="headerlink" href="#module-sqlalchemy.dialects.mssql.adodbapi" title="Permalink to this headline">¶</a></h2>
<p>Support for the Microsoft SQL Server database via the adodbapi driver.</p>
<div class="section" id="dialect-mssql-adodbapi-url">
<h3>DBAPI<a class="headerlink" href="#dialect-mssql-adodbapi-url" title="Permalink to this headline">¶</a></h3>
<p>Documentation and download information (if applicable) for adodbapi is available at:
<a class="reference external" href="http://adodbapi.sourceforge.net/">http://adodbapi.sourceforge.net/</a></p>
</div>
<div class="section" id="dialect-mssql-adodbapi-connect">
<h3>Connecting<a class="headerlink" href="#dialect-mssql-adodbapi-connect" title="Permalink to this headline">¶</a></h3>
<p>Connect String:<div class="highlight-python"><pre>mssql+adodbapi://&lt;username&gt;:&lt;password&gt;@&lt;dsnname&gt;</pre>
</div>
</p>
</div>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">The adodbapi dialect is not implemented SQLAlchemy versions 0.6 and
above at this time.</p>
</div>
</div>
</div>

    </div>

</div>

<div id="docs-bottom-navigation" class="docs-navigation-links">
        Previous:
        <a href="informix.html" title="previous chapter">Informix</a>
        Next:
        <a href="mysql.html" title="next chapter">MySQL</a>

    <div id="docs-copyright">
        &copy; <a href="../copyright.html">Copyright</a> 2007-2013, the SQLAlchemy authors and contributors.
        Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.1.3.
    </div>
</div>

</div>

        
    </body>
</html>


